<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
    <title>系统参数配置管理</title>
    <script src="/static/skin.js"></script>
	<link rel="stylesheet" href="/static/basic/plugins/easyui/themes/icon.css" >
	<script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
	<script src="/static/basic/plugins/easyui/jquery.easyui.min.js"></script>
	<script src="/static/init.js"></script>
	<script src="/static/init-datagrid.js?v=12"></script>
	<script src="/static/basic/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script src="https://cdn.staticfile.org/moment.js/2.24.0/moment.min.js"></script>
    
	
</head>
<body>
<div class="easyui-layout" data-options="fit:true" style="">
	<div data-options="region:'center'" style="padding:5px;">
		<div id="buttonPanel" class="easyui-panel" style="width:100%;height:50px;padding:10px;">
			<a href="javascript:void(0)" id="addButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-add'">新增</a>
			<a href="javascript:void(0)" id="editButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-edit'">编辑</a>
			<a href="javascript:void(0)" id="removeButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'">删除</a>
			<a href="javascript:void(0)" id="getChangesButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-edit'">信息变更提示</a>
            <a href="javascript:void(0)" id="cancelEditButton" class="easyui-linkbutton" data-options="plain:true" >取消当前行编辑</a>
            <a href="javascript:void(0)" id="endEditingButton" class="easyui-linkbutton" data-options="plain:true" >结束当前行编辑</a>
            <a href="javascript:void(0)" id="rejectButton" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true" >撤销</a>
			<a href="javascript:void(0)" id="saveButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-save'">保存</a>
			<!-- <a href="javascript:void(0)" id="addButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-delete'">导出</a> -->
		</div>
		<div class="tsline"></div>
		<div >
			<table id="gridList" style="height:480px;">
			</table>
		</div>
		<div class="easyui-panel">
			<div id="pager" class="easyui-pagination"></div>
		</div>
	</div>
</div>
<div id="searchbar" style="padding:2px 5px;">
<form id="searchForm" >
	名称:<input id="search-name" name="name" class="easyui-textbox" style="">
	<a id="searchButton" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-search'" >查询</a>
</form>
</div>
<script>

table="sys_properties";
sqlname="grid_sys_properties";
//初始化产品计划列表
initgridColumn();
//var comboboxDatas ;//=[{'id':'enabled','text':'启用'},{'id':'disable','text':'禁用'}]
//var dg;

var columns=[[
              {field:'checkbox',checkbox:true},
              {field:'id',hidden:true},
              {field:'name',title:'名称',sortable:true,editor:{
				type:'textbox',options:{required:true}
			  }},
			  {field:'value',title:'值',sortable:true,editor:{
					type:'textbox',options:{required:true}
				  }},
			  {field:'profile',title:'profile',sortable:true,editor:{
					type:'textbox',options:{required:true}
				  }},
			  {field:'remark',title:'备注',width:100,sortable:true,editor:{
				type:'textbox',options:{}
			  }}
          ]];
gridOptions={
		idField:'id',//指定id字段
		table:table,
		sqlname:sqlname,
	    singleSelect: true,//单选
		rownumbers:true,//显示序号
		columns:columns,//定义显示列
		toolbar:"#searchbar",
		onSortColumn:onSortColumn,//点击排序按钮触发函数
		onDblClickRow:function (rowIndex,rowData){
			dg.datagrid('beginEditing',rowData);
		},//双击行触发函数
		//selectOnCheck:false,//点击复选框是否选中该行
		//checkOnSelect:false,//点击行时是否选中复选框
		multiSort:true//是否启用多列排序
};
//

//document ready
$(function(){
	dg=$('#gridList');
	pager=$('#pager');
	//初始化检索条件
	initsearchparam();
	$('#addButton').bind('click', addRow);//新增行绑定事件
	$('#saveButton').bind('click', function(){dg.datagrid('accept');});//保存datagrid绑定事件
	$('#cancelEditButton').bind('click', function(){dg.datagrid('cancelEditing');});//取消行编辑绑定事件
	$('#endEditingButton').bind('click', function(){dg.datagrid('endEditing');});//结束行编辑绑定事件
	$('#rejectButton').bind('click', function(){dg.datagrid('rejectChanges');});//撤销编辑绑定事件		
	$('#editButton').bind('click',function(){dg.datagrid('editRow');});//编辑按钮绑定事件
    $('#removeButton').bind('click', function(){dg.datagrid('remove');});//删除行绑定事件
    $('#searchButton').bind('click', function(){dg.datagrid('load');});//查询操作绑定事件
    $('#getChangesButton').bind('click', function(){dg.datagrid('showChanges');});
    
    //$('#formCancelButton').bind('click', formCancelButton);
    //gridOptions.toolbar="#searchbar";//搜索框绑定到datagrid
    dg.datagrid(gridOptions);
    pager.pagination(paginationOptions);
    dg.datagrid("load");
    initsessioninfo();
    
});



/**
 * 初始化表格column
 */
function initgridColumn(){
	$.ajax({
		type: "post",
		contentType:"application/json",
		async:false,
		url: "/authenticated/grid/column/"+table,
		success: function(resultObject){
			if(resultObject.success){
				comboboxDatas=resultObject.data;
				combotreeDatas={};
			}else{
				alert(resultObject.message);
			}
		}
	});
	
	
}
/**
 * 初始化检索条件
 */
function initsearchparam(){
	/*$('#search-fullname').combobox({
    	panelHeight:'auto',
		editable:false,
    	valueField:'code_value',
		textField:'code_name',
		icons: [{
			iconCls:'icon-clear',
			handler:function(){
				$('#search-status').combobox('clear');
			}
		}],
        data:comboboxDatas.status
    });*/
}
/**
 * 新增一行
 */
function addRow(){
	var newRowData={id:guid()};//初始化行数据
	dg.datagrid('append',newRowData);
	
}    
</script>
</body>
</html>